<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="/assets/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/assets/css/comment/comment.css">
</head>

<body>
    <div class="layui-card">
        <div class="layui-card-header">
            文章列表
        </div>
        <div class="layui-card-body">

            <!-- 列表区域 -->
            <table class="layui-table">
                <colgroup>
                    <col width="100">
                    <col>
                    <col>
                    <col width="120">
                    <col width="100">
                    <col width="180">
                </colgroup>
                <thead>
                    <tr>
                        <th>作者</th>
                        <th>评论</th>
                        <th>评论在</th>
                        <th>提交于</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>


                </tbody>
            </table>

            <!-- 分页区域 -->
            <div id="pageBox"></div>
        </div>
    </div>

    <script src="/assets/lib/template-web.js"></script>
    <script type="text/html" id="tpl-table">
        {{if data.length>0}}
        {{each data item}}
        <tr>
            <td>{{item.author}}</td>
            <td>{{item.content}}</td>
            <td>{{item.title}}</td>
            <td>{{item.date }}</td>
            <td>{{item.state}}</td>
            <td>

                {{if item.state=='待审核'}}
                <button data-id="{{item.id}}" type="button" class="layui-btn layui-btn-xs btn-pass">批准</button>
                <button data-id="{{item.id}}" type="button" class="layui-btn layui-btn-xs layui-btn-warm btn-reject">
                    拒绝</button>
                {{else if item.state=='已拒绝' }}
                <button data-id="{{item.id}}" type="button" class="layui-btn layui-btn-xs btn-pass">批准</button>
                {{else if item.state=='已通过' }}
                <button data-id="{{item.id}}" type="button" class="layui-btn layui-btn-xs layui-btn-warm btn-reject">
                    拒绝</button>

                {{/if}}
                <!-- <a href="/article/art_edit.html?id={{item.id}}" class="layui-btn layui-btn-xs">编辑</a> -->
                <button data-id="{{item.id}}" type="button"
                    class="layui-btn layui-btn-xs layui-btn-danger btn-delete">删除</button>

            </td>
        </tr>
        {{/each}}
        {{else}}
        <tr>
            <td colspan="6" style="text-align:center">没有数据</td>
        </tr>
        {{/if}}
    </script>

    <!-- 分类模板 -->
    <script type="text/html" id="tpl-cate">
        <option value="">所以分类</option>
        {{each data item }}
        <option value="{{item.id}}">{{item.name}}</option>
        {{/each}}
    </script>
    <script src="/assets/lib/layui/layui.all.js"></script>
    <script src="/assets/lib/jquery.js"></script>
    <script src="/assets/js/baseAPI.js"></script>
    <script src="/assets/js/comment/comment.js"></script>

</body>

</html>